package com.song.osclient.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.song.osclient.App;
import com.song.osclient.R;


/**
 * Created by Administrator on 2015/9/6.
 */
public class MenuFragment extends Fragment {
    View contentView;

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        if (contentView == null) {
            contentView = inflater.inflate(R.layout.fragment_menu, container, false);
            initView();
        }
        return contentView;
    }

    private void initView() {
        TextView changeThemeLabel = (TextView) contentView.findViewById(R.id.changeLabel);
        if (App.THEME_DAY.equals(App.getCurrentThemeTag())) {
            changeThemeLabel.setText(App.THEME_NIGHT);
        } else {
            changeThemeLabel.setText(App.THEME_DAY);
        }
        contentView.findViewById(R.id.changeTheme).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                App.switchTheme();
                getActivity().recreate();
            }
        });
    }

    public View getContentView() {
        return contentView;
    }
}
